<div class="permalink-title"><h2>{{i18n 'admin.permalink.title'}}</h2></div>
<div class="pull-right">
  {{text-field value=filter class="url-input" placeholderKey="admin.permalink.form.filter" autocorrect="off" autocapitalize="off"}}
</div>
{{permalink-form action="recordAdded"}}
<br/>

{{#conditional-loading-spinner condition=loading}}
  {{#if model.length}}
    <div class='table admin-logs-table permalinks'>
      <div class="heading-container">
        <div class="col heading first url">{{i18n 'admin.permalink.url'}}</div>
        <div class="col heading topic">{{i18n 'admin.permalink.topic_title'}}</div>
        <div class="col heading post">{{i18n 'admin.permalink.post_title'}}</div>
        <div class="col heading category">{{i18n 'admin.permalink.category_title'}}</div>
        <div class="col heading external_url">{{i18n 'admin.permalink.external_url'}}</div>
        <div class="col heading actions"></div>
        <div class="clearfix"></div>
      </div>
      {{#each model as |pl|}}
        <div class="admin-list-item">
          <div class="col first url">{{pl.url}}</div>
          <div class="col topic">
            {{#if pl.topic_id}}
              <a href='{{unbound pl.topic_url}}'>{{pl.topic_title}}</a>
            {{/if}}
          </div>
          <div class="col post">
            {{#if pl.post_id}}
              <a href='{{unbound pl.post_url}}'>#{{pl.post_number}} {{pl.post_topic_title}}</a>
            {{/if}}
          </div>
          <div class="col category">
            {{#if pl.category_id}}
              <a href='{{unbound pl.category_url}}'>{{pl.category_name}}</a>
            {{/if}}
          </div>
          <div class="col external_url">
            {{#if pl.external_url}}
              <a href='{{unbound pl.external_url}}'>{{pl.external_url}}</a>
            {{/if}}
          </div>
          <div class="col action">
            {{d-button action="destroy" actionParam=pl icon="trash-o" class="btn-danger"}}
          </div>
          <div class="clearfix"></div>
        </div>
      {{/each}}
    </div>
  {{else}}
    {{i18n 'search.no_results'}}
  {{/if}}
{{/conditional-loading-spinner}}
